import { Field, Int, ObjectType } from "@nestjs/graphql";
import { BaseEntity } from "../base.entity/base.entity";
import { Classes } from "@prisma/client";
import { TeacherOnClassesEntity } from "../teacher.on.classes.entity/teacher.on.classes.entity";
import { UserEntity } from "../user.entity/user.entity";
import { ScienceEntity } from "../science.entity/science.entity";
import { ClassesCountEntity } from "./classes.count.entity";

@ObjectType()
export class ClassesEntity extends BaseEntity implements Classes {
    @Field()
    name: string;

    @Field(() => Int, { nullable: true })
    scienceId: number;

    @Field(() => ScienceEntity, { nullable: true })
    science?: ScienceEntity

    @Field(() => [TeacherOnClassesEntity], { nullable: true })
    TeacherOnClasses?: TeacherOnClassesEntity[]

    @Field(() => [UserEntity], { nullable: true })
    User?: UserEntity[]

    @Field(() => ClassesCountEntity, { nullable: true })
    _count?: ClassesCountEntity

    @Field(() => Int, { nullable: true })
    finished?: number
}
